﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dbPoll_Application.Models.CustomQuestion>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	dbPoll - Responding
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">var webURL = true;</script>
<script type="text/javascript" src="../../Scripts/PageControl.js"></script>
<script type="text/javascript" src="../../Scripts/MessageListener.js"></script>
<script type="text/javascript" src="../../Scripts/Respond-CustomQuestion.js"></script>

    <div class="pageHeadingContainer"><h2 class="pageHeading">Responding</h2></div>
    <div id="contentContainer">
        <input type="hidden" id="pollID" name="pollID" value="<%= ViewData["pollID"] %>" />
        <%= Html.HiddenFor(m => m.questionID) %>
        <%= Html.HiddenFor(m => m.allowedAnswers) %>
        <p>Respond > <%= ViewData["pollName"] %> > Question <%= Model.questionNumber %> of <%= ViewData["questionCount"] %></p>
        <div class="respondTitle"><div class="respondTitlePadding">Question
        <% if (Model.countdownTimer.active)
           { %>
        <span id="respondCountdownTimer" class="none">countdown: <%= Model.countdownTimer.countdownAmount %></span>
        <script type="text/javascript">
            $('#respondCountdownTimer').removeClass("none");
            var countdownAmount = <%= Model.countdownTimer.countdownAmount %>;
            function timer() {
                if (countdownAmount > 0) {
                    countdownAmount--;
                    $('#respondCountdownTimer').text("countdown: " + countdownAmount);
                    setTimeout("timer()", 1000);
                }
            }
            setTimeout("timer()", 1000);
        </script>
        <% } %>
        </div></div>
        <div id="respondQuestionContainer">
            <div id="respondQuestionContainerPadding">
            <div id="respondInstructions">Instructions: select up to <%= Model.allowedAnswers %> option(s) to the left and click submit.<br /><br />To change your answer, simply make your changes and press submit again.<br /><br />Once the poll master decides, a new page will load with the next question or a chart of the results.</div>
            <div id="respondQuestionText"><%= Model.question %></div>
            <div id="respondOptionsContainer">
            <% foreach (var option in Model.options)
               { %>
               <div class="respondOption"><%= Html.CheckBox(option.optionID.ToString(), false, new { @class = "optionCheckBox", id = option.optionID.ToString() })%><%= option.answer %></div>
            <% } %>
            </div>
            <div id="respondFeedback">Feedback:</div>
            <div><%= Html.TextArea("feedback", new { id = "respondFeedbackTextArea" })%></div>
            <div><input type="button" id="submit" value="Submit" /><span id="respondError"></span></div>
        </div>
        </div>
        <div class="respondTitle"><div class="respondTitlePadding">Messages</div></div>
        <div id="respondMessageContainer">
        </div>
    </div>

</asp:Content>
